﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using PloobsEngine.SceneControl;
using PloobsEngine;

namespace Etapa1
{
    public class DepthPostEffect : IPostEffect
    {

        Effect effect = null;        
        EngineStuff engine;                
        
        public void Draw(IRenderHelper rHelper,  Microsoft.Xna.Framework.GameTime gt, Microsoft.Xna.Framework.Rectangle screenRec, IWorld world)
        {
             effect.Parameters["Z_Near"].SetValue(world.ActiveCamera.NearPlane);
             effect.Parameters["Z_Far"].SetValue(world.ActiveCamera.FarPlane);
             effect.Parameters["depth_sampler"].SetValue(rHelper[PrincipalConstants.dephRT]);
             effect.Parameters["halfPixel"].SetValue(EngineStuff.HalfPixel);             
             rHelper.RenderTextureToFullScreenVertexPixel(effect);             
         
        }

        public void init(EngineStuff engine)
        {
            effect = EngineStuff.CustomContentManager.GetAsset<Effect>("..\\Content\\Effects\\CorrectDepth");            
            this.engine = engine;            

        }

    }
}


